/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package AdminOperations;

import CRUD.ForumHome;
import xmlMapping.Forum;

/**
 *
 * @author ABDELMOHSEN
 */
public class AdminManageForum {
    public void addForum(Forum f){
        ForumHome fHome=new ForumHome();
        f.setNoofthread(0);
        f.setNoofpost(0);
        fHome.persist(f);
    }
    public void deleteForum(int forumID){
        ForumHome fHome=new ForumHome();
        fHome.delete(fHome.findById(forumID));
    }
    public void updateForum(Forum newF){
        ForumHome fHome=new ForumHome();
        Forum oldF=fHome.findById(newF.getForumId());
        oldF.setDescription(newF.getDescription());
        oldF.setName(newF.getName());
        oldF.setCategory(newF.getCategory());
        fHome.persist(oldF);
    }
    
}
